from django.http import HttpResponse
def test_view(request):
    return HttpResponse("中间件测试成功！IP:"+getattr(request,'client_ip','未记录'))